-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Account Creation: Fix broken flow after signing up from the WordPress app #21751
Conversation
This reverts commit 0815f63.
📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! There was just a minor typo with a function name, but everything works 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I landed on this PR while checking the editorialized release notes.
if self?.isCancelled == true { | ||
self?.state = .isFinished | ||
DDLogInfo("🚩 Feature flags update operation canceled") | ||
self?.completion(.failure(OperationError.operationCanceled)) | ||
return | ||
} | ||
switch result { | ||
case .success(let flags): | ||
DDLogInfo("🚩 Successfully updated local feature flags: \(flags.dictionaryValue)") | ||
self?.completion(.success(flags.dictionaryValue)) | ||
case .failure(let error): | ||
DDLogError("🚩 Unable to update Feature Flag Store: \(error.localizedDescription)") | ||
self?.completion(.failure(error)) | ||
} | ||
self?.state = .isFinished |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless I'm reading the code wrong, if self
is nil
, nothing will happen other than console logs.
Have you considered returning early with guard let self else { return }
?
internal extension RemoteFeatureFlagStore { | ||
func update(using remote: FeatureFlagRemote, waitOn test: XCTestCase) { | ||
let exp = test.expectation(description: "Store finishes update") | ||
update(using: remote) { | ||
exp.fulfill() | ||
} | ||
test.wait(for: [exp], timeout: 1) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting approach. For a moment I got worried because it looked like the test was no longer testing application code, but then I looked at the implementation and realized it called the app code internally.
This has definitely value because it DRYes what would otherwise be a lot of repeated async expectations.
I wonder if the DRY could be pushed even further. Most tests have a similar arrange structure:
let store = ...
let flags = ...
let remote = ...
store.update(using: remote, waitOn: self)
Fixes #21746
Description
This PR fixes an issue where users signing up on the WordPress app land on the Reader while it should not be accessible.
The PR also introduces logic for synchronizing calls to fetch the remote feature flags, making sure that the latest network call is always respected regardless of when the response comes. This is to avoid the following scenario:
Testing Instructions
Regression Notes
Potential unintended areas of impact
Sign up flow on Jetpack
What I did to test those areas of impact (or what existing automated tests I relied on)
Tested manually
What automated tests I added (or what prevented me from doing so)
N/A
PR submission checklist:
RELEASE-NOTES.txt
if necessary.